#include"Date.h"
#include"SaveCount.h"
#include<string>
#include<ctime>
#include<vector>

#pragma once

using namespace std;
typedef pair<tmDate, vector<string>> PAIR;

class Controller
{
protected:
	string Username;
	string password;
	tmDate nowtmDate;
	string id = "0000000000000";//
	double totalmoney = 0;
	vector<vector<string>> commandList;
	static bool cmp_by_value(const PAIR& lhs, const PAIR& rhs);
public:
	string getUsername();
	string getPassword();
	vector<Account*> MyAccount;
	Controller(tmDate nowtmDate, string username,string password);
	tmDate getnowtmDate();
	tmDate setnowtmDate(tmDate newtmDate);
	string getid();
	string setid(string idnew);
	string mknewAccount(string, tmDate nowtmDate, double balance, double rate);
	string mknewAccount(string ,tmDate nowtmDate, double balance, double rate, double range,double fee);
	vector<Account*> getmDateyAccount();
	double searchBalance(string id);
	double searchAcc(string id);
	int accountOp(string id,tmDate tmDate, double money, string reason,string type);
	int accountOp(int num, tmDate tmDate, double money, string reason, string type);
	double getTotal();
	Account* searchAccount(string id);
	int groupSettle(tmDate tmDate,vector<string> allowtype);
	int groupChargeCC(tmDate tmDate);
	int settlePerYear(tmDate tmDate);
	int settlePerMonth(tmDate tmDate);
	int SettleCheck(tmDate &tmDatebig, tmDate &tmDatesmall);
	int checkInfo(tmDate start, tmDate end, vector<Account*> MyAccount);
	int checkInfowithMoney(tmDate start, tmDate end, vector<Account*> MyAccount);
	int monSet(tmDate newdate);
	int daySet(tmDate newdate);
	tmDate getCommand(char basic,tmDate &nnDate);
	tmDate getCommand(vector<string>, tmDate &nnDate);
	int fileSave();
	tmDate fileRead(tmDate nnDate);
};